﻿<UserControls:ScrumUserControl x:Class="ScrumTable.UI.View.WinTouch.UserControls.View.ConfigSetting"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:s="http://schemas.microsoft.com/surface/2008" xmlns:Converter="clr-namespace:ScrumTable.UI.View.Converter;assembly=ScrumTable.UI.View"
    xmlns:Localization="clr-namespace:ScrumTable.UI.View.Localization;assembly=ScrumTable.UI.View"  xmlns:ViewModel="clr-namespace:ScrumTable.UI.ViewModel;assembly=ScrumTable.UI.ViewModel" xmlns:UserControls="clr-namespace:ScrumTable.UI.View.WinTouch.UserControls" xmlns:Command="clr-namespace:ScrumTable.UI.View.Command;assembly=ScrumTable.UI.View" xmlns:CustomControl="clr-namespace:ScrumTable.UI.View.WinTouch.CustomControl" Background="{StaticResource ScreenConfiguration}">


    <UserControls:ScrumUserControl.CommandBindings>
        <CommandBinding 
          Command="{x:Static Command:CommandLib.AddComboBoxItem}"          
          Executed="OnAddCommand"/>
        <CommandBinding 
          Command="{x:Static Command:CommandLib.RemoveComboBoxItem}"          
          Executed="OnDeleteCommand" 
          CanExecute="OnCanDeleteCommand"/>
    </UserControls:ScrumUserControl.CommandBindings>
    
    <CustomControl:ScrumTableScrollViewer HorizontalScrollBarVisibility="Hidden" Margin="75,20,0,0">

        <Grid HorizontalAlignment="Left" VerticalAlignment="Stretch">
            <Grid.Resources>                
                <Style TargetType="{x:Type Label}" x:Key="BoldText" BasedOn="{StaticResource DescriptionLabel}"/>
                <Style TargetType="{x:Type TextBlock}">
                    <Setter Property="VerticalAlignment"  Value="Center"/>
                    <Setter Property="FontSize"  Value="12"/>
                    <Setter Property="FontStyle"  Value="Italic"/>
                    <Setter Property="Margin"  Value="40,0,0,10"/>
                </Style>

                <Style TargetType="{x:Type GroupBox}" x:Key="ConfigGroups">
                    <Setter Property="Margin"  Value="5,5,5,15"/>
                    <Setter Property="Padding"  Value="5"/>
                    <Setter Property="BorderBrush"  Value="Black"/>
                    <!--
                    <Setter Property="Background"  Value="#FFE1EEE1"/>
                    -->
                    
                </Style>

                <DataTemplate x:Key="listTemplate">
                    <!--<Label Content="{Binding ConfigName}"/>-->
                    <s:SurfaceTextBox Text="{Binding ConfigName, Mode=TwoWay}"/>
                </DataTemplate>

                <DataTemplate x:Key="listTemplate1">
                    <TextBlock  HorizontalAlignment="Left" FontSize="12" FontWeight="Bold" Height="24">
                        <TextBlock.Text>
                            <Binding Path="ConfigName" />
                        </TextBlock.Text>
                    </TextBlock>
                </DataTemplate>
            </Grid.Resources>
            <Grid.RowDefinitions>
                <RowDefinition Height="60"/>
                <RowDefinition Height="1*"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="50"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="0" />
                <ColumnDefinition Width="1*"/>
                <ColumnDefinition Width="0.05*"/>
            </Grid.ColumnDefinitions>

            <StackPanel Grid.Column="1" Grid.Row="0" HorizontalAlignment="Center" Orientation="Horizontal">
                <Label Width="400" Margin="5,5,5,5" Style="{StaticResource BoldText}"  HorizontalContentAlignment="Right" VerticalAlignment="Center" Content="{Localization:Translate Uid=Config_Preset,Default=[Preset]}" />
                <ComboBox x:Name="CurrentConfig" Width="200"  Grid.Column="1" Style="{StaticResource ComboBoxStyle1}" Grid.Row="0" Margin="5,5,5,5" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"  SelectedItem="{Binding Path=CurrentConfig, Mode=TwoWay}" ItemsSource="{Binding Path=ConfigList}" ItemTemplate="{StaticResource listTemplate1}"/>
                <UserControl Width="200" Background="{x:Null}"></UserControl>
            </StackPanel>

            <Grid Grid.Column="1" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Stretch" >
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition Height="320"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="400"/>
                    <ColumnDefinition Width="400"/>
                </Grid.ColumnDefinitions>

                <GroupBox Header="{Localization:Translate Default=[Screen], Uid=Config_Group_Screen}" BorderBrush="Black" Grid.Column="0" Style="{StaticResource ConfigGroups}">
                    <StackPanel>
                        <StackPanel Orientation="Vertical">
                            <s:SurfaceCheckBox IsChecked="{Binding CurrentConfig.IsHiddenChart}">
                                <Localization:Translate Uid="Config_IsHiddenChart" Default="[IsHiddenChart]" />
                            </s:SurfaceCheckBox>
                            <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Localization:Translate Default=[Text], Uid=Config_IsHiddenChart_Text}"/>
                        </StackPanel>
                        <StackPanel Orientation="Vertical">
                            <s:SurfaceCheckBox IsChecked="{Binding CurrentConfig.IsHiddenDailyScrum}">
                                <Localization:Translate Uid="Config_IsHiddenDailyScrum" Default="[IsHiddenDailyScrum]" />
                            </s:SurfaceCheckBox>
                            <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Localization:Translate Default=[Text], Uid=Config_IsHiddenDailyScrum_Text}"/>
                        </StackPanel>
                    </StackPanel>
                </GroupBox>

                <GroupBox Header="{Localization:Translate Default=[Company], Uid=Config_Group_Company}" Grid.Column="1" Style="{StaticResource ConfigGroups}">
                    <StackPanel>
                        <StackPanel Orientation="Vertical">
                            <s:SurfaceCheckBox IsChecked="{Binding CurrentConfig.IsStackRankDescending}">
                                <Localization:Translate Uid="Config_IsStackRankDescending" Default="[IsStackRankDescending]" />
                            </s:SurfaceCheckBox>
                            <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Localization:Translate Default=[Text], Uid=Config_IsStackRankDescending_Text}"/>
                        </StackPanel>
                        <!--
                        <StackPanel Orientation="Vertical">
                            <s:SurfaceCheckBox IsChecked="{Binding CurrentConfig.ShowCustomScrumMap}">
                                <Localization:Translate Uid="Config_ShowCustomScrumMap" Default="[ShowCustomScrumMap]" />
                            </s:SurfaceCheckBox>
                            <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Localization:Translate Default=[Text], Uid=Config_ShowCustomScrumMap_Text}"/>
                        </StackPanel>
                        -->
                    </StackPanel>                     
                </GroupBox>

                <GroupBox Header="{Localization:Translate Default=[Scrum], Uid=Config_Group_Scrum}" BorderBrush="Black" Grid.Row="1" Grid.Column="0" Style="{StaticResource ConfigGroups}">
                    <StackPanel>
                        <StackPanel Orientation="Vertical">
                            <s:SurfaceCheckBox IsChecked="{Binding CurrentConfig.IsBugUserStory}">
                                <Localization:Translate Uid="Config_IsBugStory" Default="[IsBugUserStor]" />
                            </s:SurfaceCheckBox>
                            <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Localization:Translate Default=[Text], Uid=Config_IsBugStory_Text}"/>
                        </StackPanel>
<!--
                        <StackPanel Orientation="Vertical">
                            <s:SurfaceCheckBox IsChecked="{Binding CurrentConfig.ShowBugInStoryAndTaskBoard}">
                                <Localization:Translate Uid="Config_ShowBugInStoryAndTaskBoard" Default="[ShowBugInStoryAndTaskBoard]" />
                            </s:SurfaceCheckBox>
                            <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Localization:Translate Default=[Text], Uid=Config_ShowBugInStoryAndTaskBoard_Text}"/>
                        </StackPanel>
 -->
                    </StackPanel>
                </GroupBox>

                <GroupBox Header="{Localization:Translate Default=[Input], Uid=Config_Group_Input}" BorderBrush="Black" Grid.Row="1" Grid.Column="1" Style="{StaticResource ConfigGroups}">
                    <StackPanel>
                        <StackPanel Orientation="Vertical">
                            <s:SurfaceCheckBox IsChecked="{Binding CurrentConfig.ShowResizeButton}">
                                <Localization:Translate Uid="Config_ShowResize" Default="[Show Resize]" />
                            </s:SurfaceCheckBox>
                            <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Localization:Translate Default=[Text], Uid=Config_ShowResize_Text}"/>
                        </StackPanel>
                        <StackPanel Orientation="Vertical">
                            <s:SurfaceCheckBox IsChecked="{Binding CurrentConfig.IsContextMenuHide}">
                                <Localization:Translate Uid="Config_IsContextHide" Default="[Hide Drag and Drop context menu]" />
                            </s:SurfaceCheckBox>
                            <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Localization:Translate Default=[Text], Uid=Config_IsContextHide_Text}"/>
                        </StackPanel>
                    </StackPanel>
                </GroupBox>

                <GroupBox Header="{Localization:Translate Default=[Size], Uid=Config_Group_Size}" Grid.Row="2" Grid.Column="0" Style="{StaticResource ConfigGroups}">

                    <StackPanel>
                        <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" VerticalAlignment="Top" Text="{Localization:Translate Default=[Text], Uid=Config_ElementSize_Text}"/>

                        <Grid Margin="40,0,40,0" Height="180" >
                            <Border BorderBrush="Black" BorderThickness="1" Background="LightGray" CornerRadius="10" Margin="0,3,0,3" Opacity="0.8"/>
                            <Border CornerRadius="10" Margin="0,3,0,3">
                                <Grid >
                                    <s:SurfaceScrollBar Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Top"  Margin="25,0,0,0" Name="ScrollWidth" Minimum="80" Maximum="220" Value="{Binding Path=CurrentConfig.ControlSize.X }" />
                                    <s:SurfaceScrollBar Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Stretch" Margin="0,25,0,0" Name="ScrollHeight" Minimum="80" Maximum="140" Value="{Binding Path=CurrentConfig.ControlSize.Y }" >
                                        <ScrollBar.LayoutTransform>
                                            <RotateTransform Angle="90"/>
                                        </ScrollBar.LayoutTransform>
                                    </s:SurfaceScrollBar>
                                    <UserControls:UserStoryControl x:Name="UserStoryPreview" Width="{Binding ElementName=ScrollWidth, Path=Value}"  MinWidth="0" MinHeight="0" Height="{Binding ElementName=ScrollHeight, Path=Value}" Margin="30,30,0,0" MaxWidth="300" MaxHeight="300" HorizontalAlignment="Left" VerticalAlignment="Top" />
                                </Grid>
                            </Border>
                        </Grid>
                    </StackPanel>
                </GroupBox>

                <GroupBox  Grid.Row="2" Grid.Column="1" Style="{StaticResource ConfigGroups}">
                    <GroupBox.Header>
                        <Grid Margin="0,-14,0,0">
                            <s:SurfaceCheckBox Margin="0,0,0,0"  x:Name="CheckMultiScreenEnabled" IsChecked="{Binding CurrentConfig.MultiScreenModeEnabled}" Click="OnCheckMultiScreenEnabledClick">
                                <Localization:Translate Uid="Config_MultiScreenEnabled" Default="[Enable multiple screen mode]" />
                                <s:SurfaceCheckBox.RenderTransform>
                                    <TranslateTransform  X="0" Y="10"/>
                                </s:SurfaceCheckBox.RenderTransform>
                            </s:SurfaceCheckBox>
                        </Grid>
                    </GroupBox.Header>
                    <Grid>
                        <StackPanel  Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" Orientation="Vertical" VerticalAlignment="Top">
                            <TextBlock TextWrapping="Wrap" VerticalAlignment="Top" Text="{Localization:Translate Default=[Text], Uid=Config_MultiScreenEnabled_Text}"/>

                            <Grid Margin="40,0,40,0">
                                <Border BorderBrush="Black" BorderThickness="1" Background="LightGray" CornerRadius="10" Padding="5" Margin="0,3,0,3" Opacity="0.8">
                                </Border>
                                <Border BorderBrush="Black" BorderThickness="1" CornerRadius="10" Padding="5" Margin="0,3,0,3">
                                    <Grid Name="ScreenSettings" Margin="0,0,0,0" Height="130" MaxHeight="130" Width="275" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                                    </Grid>
                                </Border>
                            </Grid>

                            <s:SurfaceButton Margin="0,5,0,10" Click="OnCombine" HorizontalAlignment="Center" VerticalAlignment="Bottom" IsEnabled="{Binding ElementName=CheckMultiScreenEnabled, Path=IsChecked}">
                                <Localization:Translate Uid="Config_ScreenCombine" Default="[Set selected screen as one screen]" />
                            </s:SurfaceButton>
                        </StackPanel>
                    </Grid>
                </GroupBox>
            </Grid>

            <s:SurfaceButton   Visibility="{Binding InWizardMode, Converter={StaticResource ResourceKey=ConverterBoolToVisibility}}" FontSize="14" FontWeight="Bold" Grid.ColumnSpan="10" Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Center"  Width="200" Height="40" Margin="0,20,0,0" Click="OnNextClick" Style="{StaticResource SurfaceButtonStyle}" >
                <s:SurfaceButton.Content>
                    <Localization:Translate Uid="ProjectSettings_ButtonNext" Default="[Next]" />
                </s:SurfaceButton.Content>
            </s:SurfaceButton>

        </Grid>
    </CustomControl:ScrumTableScrollViewer>
    
</UserControls:ScrumUserControl>
